\documentclass[10pt,a4paper]{article} 

\usepackage{ctex} % 中文支持
\usepackage[top=2.5cm, bottom=2.5cm, left=2.5cm, right=2.5cm]{geometry} % 页边距
\usepackage{amsmath, amssymb} % 数学公式与符号
\usepackage{graphicx}
\usepackage{pythonhighlight}
\usepackage{url} 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{titling}
\setlength{\droptitle}{-2cm} % 标题上移

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%文档的题目、作者与日期
\author{五六七 }
\title{逻辑斯特人口增长模型 }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\maketitle

\begin{abstract}
使用 Logistic人口模型拟合美国从1790年到2000年的人口数据。
\end{abstract}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\setcounter{tocdepth}{2}
%\renewcommand\contentsname{目录}
%
%\renewcommand {\baselinestretch} {1.3}\normalsize 
%\tableofcontents 
%\renewcommand {\baselinestretch} {1.0}\normalsize


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{问题描述}

近两个世纪以来的美国人口统计数据如表所示。对这些数据拟合一条曲线，并预测2010年的人口。

\begin{table}[ht]\centering
\caption{美国人口统计数据}
\vspace{0.2cm}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|}\hline
年份 & 1790 & 1800 & 1810 & 1820 & 1830 & 1840 & 1850 & 1860 \\ \hline 
人口 & 3.9 & 5.3 & 7.2 & 9.6 & 12.9 & 17.1 & 23.2 & 31.4 \\ \hline \hline 
年份 & 1870 & 1880 &1890 & 1900 & 1910 & 1920 &1930 & 1940 \\ \hline 
人口 & 38.6 & 50.2 & 62.9 & 76.0 & 92.0 & 106.5 & 123.2 & 131.7 \\ \hline \hline 
年份 & 1950 &1960 &1970 & 1980 & 1990 & 2000 & & \\ \hline 
人口 & 150.7 & 179.3 & 204.0 & 226.5 & 251.4 & 281.4 && \\ \hline 
\end{tabular}
\end{table}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{建模与求解}

设 $x(t)$ 是第 $t$ 年的人口数量。设年增长率为 $r(x,t)$. 则有微分方程
\begin{eqnarray}
\frac{dx}{dt} = r(x,t). 
\end{eqnarray}
对制约增长率的因素的不同分析，会得出不同的 $r(x,t)$ 的表达式。指数增长模型的思路是设
\begin{eqnarray}
r(x,t)=rx, 
\end{eqnarray}
其中 $r$ 是参数。这时的微分方程的解函数为 
\begin{eqnarray}
x(t)=x(t_0)e^{r(t-t_0)}.
\end{eqnarray}
由于资源和环境的制约，增长率随着人口总量到达一定数目后逐步放缓，Logistic模型的思路是设
\begin{eqnarray}
r(x,t)=rx(1-\frac{x}{x_m}), 
\end{eqnarray}
其中当 $x<x_m$ 时，增长率总是正的，而当 $x=x_m$ 时，增长率变为零。这说明 $x_m$ 是人口数目的最大值。使用分离变量法求解该微分方程，可得
\begin{eqnarray}
\frac{dx}{x(1-\frac{x}{x_m})} = rdt. 
\label{eqn-5}
\end{eqnarray}
左边分式化简，可得
\begin{eqnarray}
\left(\frac{1}{x}+\frac{1}{x_m-x} \right)dx = rdt. 
\end{eqnarray}
两边积分，可得
\begin{eqnarray}
\ln(x) - \ln(x_m-x) = rt + c,  
\end{eqnarray}
其中 $c$ 是任意常数。将 $x$ 写成 $t$ 的函数，可得
\begin{eqnarray}
x = \frac{x_m}{1+ke^{-rt}},
\label{eqn-8}
\end{eqnarray}
其中 $k=e^c$ 是另一个任意常数。注意到这个函数模型有三个参数，分别是 $x_m,r$ 与 $k$.  

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{参数估计}
先画出数据的散点图，如图1所示。
 \begin{figure}[ht!]
 \centering
 \includegraphics[height=6cm, width=9cm]{us-population.png}
\caption{人口数量图}
 \end{figure}

为估计参数，需要在公式(\ref{eqn-8})中代入 $(t,x(t))$ 的数据，然后计算参数 $x_m,r$ 与 $k$ 的值。
一种方法是将公式(\ref{eqn-5})写成
\begin{eqnarray}
\frac{1}{x}\frac{dx}{dt} = r(1-\frac{x}{x_m})=r-\frac{r}{x_m}x=:r-bx. 
\label{eqn-9}
\end{eqnarray}
其中 $b=\frac{r}{x_m}$ 是未知参数。等式左边的微分用差分代替，这样就得到一系列关于未知参数 $r$ 与 $b$ 的线性方程组。于是可以用最小二乘法求解。

%\begin{table}[ht]\centering
%\caption{计算差分，代入方程(\ref{eqn-9})}
%\vspace{0.2cm}
%\begin{tabular}{|c|c|c|c|}\hline
%时间区间 & $\frac{dx}{dt}\approx \frac{\Delta x}{10}$ & $\frac{1}{x}\frac{dx}{dt}$ & $r-bx$ \\ \hline 
%1790-1800&0.14&0.2564& $r-3.9b$ \\ \hline 
%1800-1810&0.19&0.1887& $r-5.3b$ \\ \hline 
%\vdots&\vdots&\vdots&\vdots \\ \hline 
%1990-2000&3.0&0.0040& $r-251.4b$ \\ \hline 
%\end{tabular}
%\end{table}

\begin{eqnarray}
\begin{bmatrix}1&-x_0 \\ 1&-x_1\\ \vdots&\vdots \\ 1&-x_{n-1} \end{bmatrix}
\cdot 
\begin{bmatrix} r \\ b \end{bmatrix}
=
\begin{bmatrix} 
\frac{1}{x_0}\cdot \frac{x_1-x_0}{t_1-t_0} \\ 
\frac{1}{x_1}\cdot \frac{x_2-x_1}{t_2-t_1} \\ 
\vdots \\ 
\frac{1}{x_{n-1}}\cdot \frac{x_n-x_{n-1}}{t_n-t_{n-1}} \\ 
\end{bmatrix}
\label{eqn-10}
\end{eqnarray}
将线性方程组(\ref{eqn-10})简记为 $AX=B$, 其中 $A$ 是 $n\times 2$ 矩阵，未知数列向量 $X=(r,b)^t$. 则两边同时左乘 $A^t$ 可得 $A^tAX=A^tB$, 这样就可以求得 $X=(A^tA)^{-1}A^tB$. 使用程序计算可得
\begin{eqnarray}
\begin{bmatrix} r \\ b \end{bmatrix}
=
\begin{bmatrix} 0.03245185 \\ 0.00011024 \end{bmatrix}. 
\label{eqn-11}
\end{eqnarray}
由此求出 $x_m=r/b=294.3860$, 即模型得出的人口最大容量为2.95亿。
然而查阅资料可知2020年美国人口总数约为3.36亿，可见这个模型并不准确。未完待续。

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{模型检验}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{预测}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newpage
\section{附录}
\subsection{散点图}
\begin{python}
import numpy as np
t=np.linspace(start=1790,stop=2000,num=22,endpoint=True)
x=np.array([3.9, 5.3, 7.2, 9.6, 12.9, 17.1, 23.2, 31.4, 
            38.6, 50.2, 62.9, 76.0, 92.0, 106.5, 123.2, 131.7,
            150.7, 179.3, 204.0, 226.5, 251.4, 281.4])

import matplotlib.pyplot as plt
fig=plt.figure()
ax=fig.add_subplot(111)
ax.plot(t,x,'o')
ax.set_xlabel('year')
ax.set_ylabel('millions people ')
fig.savefig('us-population.png')
\end{python}

\subsection{最小二乘法估计参数}
\begin{python}
xx=x[0:-1] 
xx=xx.reshape((21,1))
aa=np.ones_like(xx)
A=np.hstack((aa,-xx))

B=np.diff(x)/x[0:-1]/10
B=B.reshape((21,1))
rb=np.dot(np.linalg.inv(np.dot(A.T,A)),np.dot(A.T,B))
\end{python}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\section{参考文献 }
\begin{thebibliography}{99}
\bibitem{sishoukui-2} 司守奎,孙玺菁. \emph{Python数学建模算法与应用}, 国防工业出版社. 2022年1月第1版. 
\bibitem{ding} 丁同仁, 李承治. \emph{常微分方程教程}, 高等教育出版社. 2004年7月第2版. 

\end{thebibliography}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\end{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

